﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq.Mapping;

namespace G.Reader.Data
{
    [Table]
    public class Message:BaseTable
    {
        private int id;

        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int ID
        {
            get
            {
                return id;
            }
            set
            {
                if (id != value)
                {
                    NotifyPropertyChanging("ID");
                    id = value;
                    NotifyPropertyChanged("ID");
                }
            }
        }

        private int fromId;

        [Column]
        public int FromId
        {
            get
            {
                return fromId;
            }
            set
            {
                if (fromId != value)
                {
                    NotifyPropertyChanging("FromId");
                    fromId = value;
                    NotifyPropertyChanged("FromId");
                }
            }
        }


        private int reciveID;

        [Column]
        public int ReciveID
        {
            get
            {
                return reciveID;
            }
            set
            {
                if (reciveID != value)
                {
                    NotifyPropertyChanging("ReciveID");
                    reciveID = value;
                    NotifyPropertyChanged("ReciveID");
                }
            }
        }


        private MessageType messageType;

        [Column]
        public MessageType MessageType
        {
            get
            {
                return messageType;
            }
            set
            {
                if (messageType != value)
                {
                    NotifyPropertyChanging("MessageType");
                    messageType = value;
                    NotifyPropertyChanged("MessageType");
                }
            }
        }


        private byte[] body;
        [Column]
        public byte[] Body
        {
            get
            {
                return body;
            }
            set
            {
                if (body != value)
                {
                    NotifyPropertyChanging("Body");
                    body = value;
                    NotifyPropertyChanged("Body");
                }
            }
        }


        private bool isRead;

        [Column]
        public bool IsRead
        {
            get
            {
                return isRead;
            }
            set
            {
                if (isRead != value)
                {
                    NotifyPropertyChanging("IsRead");
                    isRead = value;
                    NotifyPropertyChanged("IsRead");
                }
            }
        }


    }

    public enum MessageType
    {
        Text,
        AddFriendRequest,
        ShareRequest
    }
}
